home *** CD-ROM | disk | FTP | other *** search
- on MoveBackground
- global theFirstBackgroundFrame, theLastBackgroundFrame, theBackgroundVelocity, theInitialBackgroundLocs
- repeat with h = theFirstBackgroundFrame to theLastBackgroundFrame
- set the locH of sprite h to the locH of sprite h + theBackgroundVelocity
- end repeat
- set tempValue to the stageRight
- set leftValue to the stageLeft
- if theBackgroundVelocity < 0 then
- if the right of sprite theFirstBackgroundFrame <= 0 then
- set x1 to the right of sprite theLastBackgroundFrame
- set x2 to x1 + the width of sprite theFirstBackgroundFrame
- set y1 to the top of sprite theFirstBackgroundFrame
- set y2 to the bottom of sprite theFirstBackgroundFrame
- spriteBox(theFirstBackgroundFrame, x1, y1, x2, y2)
- else
- if the right of sprite theLastBackgroundFrame <= 0 then
- set x1 to the right of sprite theFirstBackgroundFrame
- set x2 to x1 + the width of sprite theLastBackgroundFrame
- set y1 to the top of sprite theLastBackgroundFrame
- set y2 to the bottom of sprite theLastBackgroundFrame
- spriteBox(theLastBackgroundFrame, x1, y1, x2, y2)
- end if
- end if
- else
- if theBackgroundVelocity > 0 then
- if the left of sprite theFirstBackgroundFrame >= (the stageRight - the stageLeft) then
- set x1 to the left of sprite theLastBackgroundFrame - the width of sprite theFirstBackgroundFrame
- set x2 to x1 + the width of sprite theFirstBackgroundFrame
- set y1 to the top of sprite theFirstBackgroundFrame
- set y2 to the bottom of sprite theFirstBackgroundFrame
- spriteBox(theFirstBackgroundFrame, x1, y1, x2, y2)
- else
- if the left of sprite theLastBackgroundFrame >= (the stageRight - the stageLeft) then
- set x1 to the left of sprite theFirstBackgroundFrame - the width of sprite theLastBackgroundFrame
- set x2 to x1 + the width of sprite theLastBackgroundFrame
- set y1 to the top of sprite theLastBackgroundFrame
- set y2 to the bottom of sprite theLastBackgroundFrame
- spriteBox(theLastBackgroundFrame, x1, y1, x2, y2)
- end if
- end if
- end if
- end if
- end
-